﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HRM.BLL;
using HRM.DAL.DAO;

namespace HRM.UI.EmployeeUI.Profile
{
    public partial class ReadMessage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadMessage();

            }
        }

        private void LoadMessage()
        {
            MessageManager manager = new MessageManager();
            DAL.DAO.Message message = new DAL.DAO.Message();
            int msgId = Convert.ToInt32(Request.QueryString["msgId"]);
            message = manager.ReadMessage(msgId);

            Session["sender"] = message.Sender.CodeName;
            Session["subject"] = "Re:" + message.Subject;
            lblMessageBody.Text = message.MessageBody;
            lblMessageBody.Text.Replace("<br/>", char.ConvertFromUtf32(13));
            lblSubject.Text = message.Subject;
            lblSenderName.Text = message.SenderName;
            lblSendingDate.Text = message.Date;
            lblSenderCode.Text = message.Sender.CodeName;

        }
    }
}